// import { markerClicked } from "@/bus";
import MarkerIconConstructer from "./markerIcon.vue";
import type { IMarkerIconExposedProps, IPoiExt } from "@/common/MapTypes";

import { render, createVNode } from "vue";

/**
 *
 * @param poi 地点信息
 * @param options 其他配置
 * @returns
 */
export default function createMarkerContent(
  poi: IPoiExt,
  options?: {
    onClick?: (event: IMarkerIconExposedProps) => void;
  }
): HTMLElement {
  const container = document.createElement("view");
  const vm = createVNode(MarkerIconConstructer, {
    ...poi,
    ...options,
    // onClick(poi: IMarkerIconExposedProps) {
    //   uni.$emit(markerClicked, poi);
    // },
  });
  render(vm, container);
  return container.firstChild as HTMLElement;
}
